﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Data;

namespace Parylene_CVD.Service
{
    public class WidthToRectangleWidthConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is double totalWidth)
            {
                // 每行 4 个设备，加上 Margin 和 Border
                return (totalWidth - 100) / 4;
            }
            return 200; // 默认宽度
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
    }

    public class HeightToRectangleHeightConverter : IValueConverter
    {
        public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
        {
            if (value is double totalHeight)
            {
                // 假设 2 行设备，加上 Margin 和 Border
                return (totalHeight - 100) / 2;
            }
            return 200; // 默认高度
        }

        public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
    }

}
